package com.catazy.module_wechat.viewmodel

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.catazy.module_wechat.repository.WxRepository
import com.catazy.module_wechat.viewmodel.WeChatViewModel
import dagger.hilt.android.scopes.ActivityRetainedScoped
import javax.inject.Inject

/**
 *  author: wangyb
 *  date: 3/29/21 9:47 PM
 *  description: todo
 */
@ActivityRetainedScoped
class WeChatViewModelFactory @Inject constructor(private val repository: WxRepository) :
    ViewModelProvider.NewInstanceFactory() {

    @Suppress("UNCHECKED_CAST")
    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        return WeChatViewModel(repository) as T
    }
}